#pragma once

#include <Eigen/Dense>
#include "eigen/hidden_layer.h"

namespace  ldl_eigen
{
class AveragePooling : public HiddenLayer
{
public:
    using HiddenLayer::forward;
    using HiddenLayer::backward;
    AveragePooling(int64_t width, int64_t height, int64_t pooling_size, int64_t stride = 1, int64_t padding = 0);
    virtual ~AveragePooling() = default;

    virtual void forward() override;

    virtual void backward() override;
private:
    int64_t m_width{};
    int64_t m_height{};
    int64_t m_pooling_size{};
    int64_t m_stride{};
    int64_t m_padding{};
    /**
     * @brief 添加padding之后的宽度
     */
    int64_t m_padding_width{};

    /**
     * @brief 添加padding之后的高度
     */
    int64_t m_padding_height{};
    int64_t m_output_height{};
    int64_t m_output_width{};
    /**
     * @brief 滑动窗口行最大滑动距离
     */
    int64_t m_row_sliding_max{};

    /**
     * @brief 滑动窗口列最大滑动距离
     */
    int64_t m_col_sliding_max{};
};
}
